<template>
  <div class="not-found-page">
    <div class="not-found-content">
      <div class="error-icon">🔍</div>
      <h1 class="error-title">404</h1>
      <h2 class="error-subtitle">页面未找到</h2>
      <p class="error-description">
        抱歉，您访问的页面不存在或已被移动。
      </p>
      
      <div class="error-actions">
        <router-link to="/" class="btn btn-primary">
          <i class="icon-home"></i>
          <span>返回首页</span>
        </router-link>
        <button @click="goBack" class="btn btn-secondary">
          <i class="icon-back"></i>
          <span>返回上页</span>
        </button>
      </div>
      
      <div class="suggestions">
        <h3 class="suggestions-title">您可能想要访问：</h3>
        <ul class="suggestions-list">
          <li>
            <router-link to="/chat" class="suggestion-link">
              <i class="icon-chat"></i>
              <span>聊天界面</span>
            </router-link>
          </li>
          <li>
            <router-link to="/demo/layout" class="suggestion-link">
              <i class="icon-layout"></i>
              <span>布局演示</span>
            </router-link>
          </li>
          <li>
            <router-link to="/settings" class="suggestion-link">
              <i class="icon-settings"></i>
              <span>系统设置</span>
            </router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

const goBack = () => {
  if (window.history.length > 1) {
    router.go(-1)
  } else {
    router.push('/')
  }
}
</script>

<style scoped>
.not-found-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  background: var(--color-background);
}

.not-found-content {
  text-align: center;
  max-width: 500px;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.7;
}

.error-title {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 6rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  line-height: 1;
}

.error-subtitle {
  margin: 0 0 var(--spacing-lg) 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.error-description {
  margin: 0 0 var(--spacing-xl) 0;
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: var(--spacing-lg);
  justify-content: center;
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-xl);
  border: 1px solid transparent;
  border-radius: var(--border-radius-lg);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-hover);
  border-color: var(--color-border-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.suggestions {
  padding-top: var(--spacing-xl);
  border-top: 1px solid var(--color-border);
}

.suggestions-title {
  margin: 0 0 var(--spacing-lg) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.suggestions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.suggestion-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.suggestion-link:hover {
  background: var(--color-hover);
  color: var(--color-text);
  transform: translateX(4px);
}

/* 图标样式 */
.icon-home::before { content: '🏠'; }
.icon-back::before { content: '⬅️'; }
.icon-chat::before { content: '💬'; }
.icon-layout::before { content: '📐'; }
.icon-settings::before { content: '⚙️'; }

/* 响应式设计 */
@media (max-width: 768px) {
  .not-found-page {
    padding: var(--spacing-lg);
  }
  
  .error-title {
    font-size: 4rem;
  }
  
  .error-subtitle {
    font-size: var(--font-size-xl);
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }
}
</style>